import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(
    home: MediaQueryExample(),
    debugShowCheckedModeBanner: false,
  ));
}

class MediaQueryExample extends StatelessWidget {
  const MediaQueryExample({super.key});

  @override
  Widget build(BuildContext context) {
    final data = MediaQuery.of(context);

    return Scaffold(
      appBar: AppBar(title: const Text("MediaQuery 学习案例")),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: ListView(
          children: [
            Text("屏幕尺寸: ${data.size}"),
            Text("方向: ${data.orientation}"),
            Text("像素比 devicePixelRatio: ${data.devicePixelRatio}"),
            Text("字体缩放 textScaleFactor: ${data.textScaleFactor}"),
            Text("状态栏/刘海 padding: ${data.padding}"),
            Text("键盘区域 viewInsets: ${data.viewInsets}"),
            Text("安全区域 viewPadding: ${data.viewPadding}"),
            Text("亮度: ${data.platformBrightness}"),
            Text("是否24小时制: ${data.alwaysUse24HourFormat}"),
            Text("无障碍导航: ${data.accessibleNavigation}"),
          ],
        ),
      ),
    );
  }
}
